The present invention relates generally to image processing, and more particularly to removing aliasing effects that occur when sampling a continuous image.
There are a wide variety of computer applications which generate images. These applications include games, graphic design, animation, simulation, visualization, modeling, and the like. In these applications, the generated images should be as realistic as possible.
In computer graphics, a generated image is represented as a regular array of discrete samples of a continuous image. This xe2x80x9cdiscrete imagexe2x80x9d is a result of sampling the continuous image at some fixed and finite rate. The individual sample points are referred to as pixels. It is critical to remember that a pixel is a sampling point, not a rectangular area in the discrete image.
Because the sampling rate is finite, high frequencies present in the continuous image can xe2x80x9caliasxe2x80x9d as incorrect low frequencies. Some common features in continuous images, such as edges, contain infinitely high frequencies, so any finite sampling rate will invariably lead to aliasing. In computer-generated images, the aliasing appears as stair-stepped contours of image objects, i.e., so called xe2x80x9cjaggies.xe2x80x9d Other aliasing effects can cause moire patterns and the break-up of fine details.
Anti-aliasing is used to improve the appearance of discrete images. Anti-aliasing is accomplished by computing and sampling a convolution of the continuous image with some frequency-limiting filter. The pixels are samples of the filtered version of the continuous image. There are two common methods used to compute the samples of this convolution in the prior art: area sampling and point sampling.
Area sampling anti-aliasing uses a processed but still continuous form of the continuous image to exactly compute the convolution of an anti-aliasing filter function and this continuous image. This convolution is sampled to produce a value to be used while determining a pixel in the discrete image. Typically, the filter function is a Gaussian filter having a radius R. The radius defines the xe2x80x9cfootprintxe2x80x9d or xe2x80x9csupportxe2x80x9d of the filter.
The processed form of the continuous image used by area sampling is usually a set of polygons visible in the filter footprint around each pixel. Unfortunately, in many cases the continuous image is defined by a three-dimensional scene description including geometric objects which can occlude or intersect one another. These occlusions and intersections make it difficult to efficiently process the continuous image into a form suitable for area sampling because complicated shapes can result from the interaction of even simple objects.
Point sampling anti-aliasing uses multiple point sample locations in the vicinity of a pixel. The continuous image is evaluated at points corresponding to the pixel locations, and the resulting values are combined according to some weighting function in an attempt to approximate the convolution of the filter with the continuous image. Point sampling is the most common method used for anti-aliasing because of its simplicity and ease of implementation. Point sampling simplifies the occlusion problem present in area sampling of three-dimensional scenes, but suffers from slow convergence to the correct solution.
In general, N point samples are required to compute the value of a pixel with an accuracy of 1/N. Because the point sample locations are separated from each other and not connected, fine details can be missed entirely in the sampling. Consequently, the missed details fail to contribute to the discrete image.
Area and point sampling methods are often combined in rendering systems. Area sampling can be applied efficiently to two-dimensional sampled images, such as texture maps, while point sampling is generally used to anti-alias the edges and intersections of polygons. Point sampling is used to generate weighted coverage values (WCVs) for polygons that lie within the filter footprint of some pixel, which are then associated with that pixel. A WCV is the result of the convolution of the visible portion of a polygon with the anti-aliasing filter at a pixel that weights the color contribution of that polygon to the color of that pixel. An area sampling method is used to produce colors for the polygons, which are also associated with that pixel. The WCVs and colors associated with that pixel are then combined to produce the final color for the pixel in the discrete image.
Max, in xe2x80x9cAnti-aliasing Scan-Line Data,xe2x80x9d IEEE Computer Graphics and Applications, 10(1): 18-30, January 1990, describes a hybrid method. His hybrid method provides continuous anti-aliasing in one direction, by approximating area sampling, while using supersampling to anti-alias the other direction. Edges that run substantially parallel to the continuous direction are anti-aliased less effectively than edges that are substantially perpendicular to the continuous direction.
Accordingly, there are numerous drawbacks and disadvantages of prior art area and point sampling anti-aliasing methods. Therefore, there is a need to provide an improved anti-aliasing method without a large increase in memory or a decrease in drawing speed while generating discrete images.
The invention provides a method that uses a filter function to generate an anti-aliased discrete image sampled from a continuous image including an edge. The method defines a line sample. A progressive convolution is derived from the filter function and the line sample. A pixel at a predetermined location in the discrete image is selected, and the line sample is oriented with respect to the selected pixel.
A distance is measured from a point in the continuous image corresponding to the selected pixel to the edge along the oriented line sample. The progressive convolution is evaluated at the measured distance to produce a weighted coverage value, and the weighted coverage value is associated with the pixel to anti-alias the pixel in the discrete image.
In one aspect of the invention, only visible edges are anti-aliased, and only pixels within a predetermined distance from the edge are considered, for example, the distance is less than or equal to a length of the line sample.
In another aspect of the invention, the line sample is straight, centered on the pixel, and substantially perpendicular to the edge.
In yet another aspect of the invention, the filter function is a Gaussian function, and the progressive convolution is a cumulative integral of the filter function for various distances. The progressive convolution can be defined by a continuous function, or alternatively, the values of the progressive convolution are stored in a table for a finite number of distances.
In yet another aspect of the invention, multiple line samples are defined for each pixel and the weighted coverage values of the line samples are combined to produce a combined weighted coverage value which is associated with the pixel.